Optimal. Leaf size=158 \[ \frac {(g+h x)^3 \left (B \log \left (e (a+b x)^n (c+d x)^{-n}\right )+A\right )}{3 h}-\frac {B n (b g-a h)^3 \log (a+b x)}{3 b^3 h}-\frac {B h n x (b c-a d) (-a d h-b c h+3 b d g)}{3 b^2 d^2}-\frac {B h^2 n x^2 (b c-a d)}{6 b d}+\frac {B n (d g-c h)^3 \log (c+d x)}{3 d^3 h} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.24, antiderivative size = 170, normalized size of antiderivative = 1.08, number of steps used = 5, number of rules used = 3, integrand size = 31, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.097, Rules used = {6742, 2492, 72} \[ -\frac {B h n x (b c-a d) (-a d h-b c h+3 b d g)}{3 b^2 d^2}-\frac {B n (b g-a h)^3 \log (a+b x)}{3 b^3 h}+\frac {B (g+h x)^3 \log \left (e (a+b x)^n (c+d x)^{-n}\right )}{3 h}-\frac {B h^2 n x^2 (b c-a d)}{6 b d}+\frac {A (g+h x)^3}{3 h}+\frac {B n (d g-c h)^3 \log (c+d x)}{3 d^3 h} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 72
Rule 2492
Rule 6742
Rubi steps
\begin {align*} \int (g+h x)^2 \left (A+B \log \left (e (a+b x)^n (c+d x)^{-n}\right )\right ) \, dx &=\int \left (A (g+h x)^2+B (g+h x)^2 \log \left (e (a+b x)^n (c+d x)^{-n}\right )\right ) \, dx\\ &=\frac {A (g+h x)^3}{3 h}+B \int (g+h x)^2 \log \left (e (a+b x)^n (c+d x)^{-n}\right ) \, dx\\ &=\frac {A (g+h x)^3}{3 h}+\frac {B (g+h x)^3 \log \left (e (a+b x)^n (c+d x)^{-n}\right )}{3 h}-\frac {(B (b c-a d) n) \int \frac {(g+h x)^3}{(a+b x) (c+d x)} \, dx}{3 h}\\ &=\frac {A (g+h x)^3}{3 h}+\frac {B (g+h x)^3 \log \left (e (a+b x)^n (c+d x)^{-n}\right )}{3 h}-\frac {(B (b c-a d) n) \int \left (\frac {h^2 (3 b d g-b c h-a d h)}{b^2 d^2}+\frac {h^3 x}{b d}+\frac {(b g-a h)^3}{b^2 (b c-a d) (a+b x)}+\frac {(d g-c h)^3}{d^2 (-b c+a d) (c+d x)}\right ) \, dx}{3 h}\\ &=-\frac {B (b c-a d) h (3 b d g-b c h-a d h) n x}{3 b^2 d^2}-\frac {B (b c-a d) h^2 n x^2}{6 b d}+\frac {A (g+h x)^3}{3 h}-\frac {B (b g-a h)^3 n \log (a+b x)}{3 b^3 h}+\frac {B (d g-c h)^3 n \log (c+d x)}{3 d^3 h}+\frac {B (g+h x)^3 \log \left (e (a+b x)^n (c+d x)^{-n}\right )}{3 h}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A] time = 0.39, size = 204, normalized size = 1.29 \[ \frac {2 a^2 B d^3 h n (a h-3 b g) \log (a+b x)+b \left (d x \left (B h n (b c-a d) (2 a d h+2 b c h-6 b d g-b d h x)+2 A b^2 d^2 \left (3 g^2+3 g h x+h^2 x^2\right )\right )-2 b B n \log (c+d x) \left (b c \left (c^2 h^2-3 c d g h+3 d^2 g^2\right )-3 a d^3 g^2\right )+2 b B d^3 \left (3 a g^2+b x \left (3 g^2+3 g h x+h^2 x^2\right )\right ) \log \left (e (a+b x)^n (c+d x)^{-n}\right )\right )}{6 b^3 d^3} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
fricas [B] time = 0.93, size = 365, normalized size = 2.31 \[ \frac {2 \, A b^{3} d^{3} h^{2} x^{3} + {\left (6 \, A b^{3} d^{3} g h - {\left (B b^{3} c d^{2} - B a b^{2} d^{3}\right )} h^{2} n\right )} x^{2} + 2 \, {\left (3 \, A b^{3} d^{3} g^{2} - {\left (3 \, {\left (B b^{3} c d^{2} - B a b^{2} d^{3}\right )} g h - {\left (B b^{3} c^{2} d - B a^{2} b d^{3}\right )} h^{2}\right )} n\right )} x + 2 \, {\left (B b^{3} d^{3} h^{2} n x^{3} + 3 \, B b^{3} d^{3} g h n x^{2} + 3 \, B b^{3} d^{3} g^{2} n x + {\left (3 \, B a b^{2} d^{3} g^{2} - 3 \, B a^{2} b d^{3} g h + B a^{3} d^{3} h^{2}\right )} n\right )} \log \left (b x + a\right ) - 2 \, {\left (B b^{3} d^{3} h^{2} n x^{3} + 3 \, B b^{3} d^{3} g h n x^{2} + 3 \, B b^{3} d^{3} g^{2} n x + {\left (3 \, B b^{3} c d^{2} g^{2} - 3 \, B b^{3} c^{2} d g h + B b^{3} c^{3} h^{2}\right )} n\right )} \log \left (d x + c\right ) + 2 \, {\left (B b^{3} d^{3} h^{2} x^{3} + 3 \, B b^{3} d^{3} g h x^{2} + 3 \, B b^{3} d^{3} g^{2} x\right )} \log \relax (e)}{6 \, b^{3} d^{3}} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
giac [B] time = 97.81, size = 298, normalized size = 1.89 \[ \frac {1}{3} \, {\left (A h^{2} + B h^{2}\right )} x^{3} + \frac {1}{3} \, {\left (B h^{2} n x^{3} + 3 \, B g h n x^{2} + 3 \, B g^{2} n x\right )} \log \left (b x + a\right ) - \frac {1}{3} \, {\left (B h^{2} n x^{3} + 3 \, B g h n x^{2} + 3 \, B g^{2} n x\right )} \log \left (d x + c\right ) - \frac {{\left (B b c h^{2} n - B a d h^{2} n - 6 \, A b d g h - 6 \, B b d g h\right )} x^{2}}{6 \, b d} + \frac {{\left (3 \, B a b^{2} g^{2} n - 3 \, B a^{2} b g h n + B a^{3} h^{2} n\right )} \log \left (b x + a\right )}{3 \, b^{3}} - \frac {{\left (3 \, B c d^{2} g^{2} n - 3 \, B c^{2} d g h n + B c^{3} h^{2} n\right )} \log \left (-d x - c\right )}{3 \, d^{3}} - \frac {{\left (3 \, B b^{2} c d g h n - 3 \, B a b d^{2} g h n - B b^{2} c^{2} h^{2} n + B a^{2} d^{2} h^{2} n - 3 \, A b^{2} d^{2} g^{2} - 3 \, B b^{2} d^{2} g^{2}\right )} x}{3 \, b^{2} d^{2}} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maple [C] time = 0.51, size = 1389, normalized size = 8.79 \[ \text {result too large to display} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maxima [A] time = 0.94, size = 294, normalized size = 1.86 \[ \frac {1}{3} \, B h^{2} x^{3} \log \left (\frac {{\left (b x + a\right )}^{n} e}{{\left (d x + c\right )}^{n}}\right ) + \frac {1}{3} \, A h^{2} x^{3} + B g h x^{2} \log \left (\frac {{\left (b x + a\right )}^{n} e}{{\left (d x + c\right )}^{n}}\right ) + A g h x^{2} + B g^{2} x \log \left (\frac {{\left (b x + a\right )}^{n} e}{{\left (d x + c\right )}^{n}}\right ) + A g^{2} x + \frac {{\left (\frac {a e n \log \left (b x + a\right )}{b} - \frac {c e n \log \left (d x + c\right )}{d}\right )} B g^{2}}{e} - \frac {{\left (\frac {a^{2} e n \log \left (b x + a\right )}{b^{2}} - \frac {c^{2} e n \log \left (d x + c\right )}{d^{2}} + \frac {{\left (b c e n - a d e n\right )} x}{b d}\right )} B g h}{e} + \frac {{\left (\frac {2 \, a^{3} e n \log \left (b x + a\right )}{b^{3}} - \frac {2 \, c^{3} e n \log \left (d x + c\right )}{d^{3}} - \frac {{\left (b^{2} c d e n - a b d^{2} e n\right )} x^{2} - 2 \, {\left (b^{2} c^{2} e n - a^{2} d^{2} e n\right )} x}{b^{2} d^{2}}\right )} B h^{2}}{6 \, e} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
mupad [B] time = 4.47, size = 372, normalized size = 2.35 \[ x^2\,\left (\frac {3\,A\,a\,d\,h^2+3\,A\,b\,c\,h^2+6\,A\,b\,d\,g\,h+B\,a\,d\,h^2\,n-B\,b\,c\,h^2\,n}{6\,b\,d}-\frac {A\,h^2\,\left (3\,a\,d+3\,b\,c\right )}{6\,b\,d}\right )+\ln \left (\frac {e\,{\left (a+b\,x\right )}^n}{{\left (c+d\,x\right )}^n}\right )\,\left (B\,g^2\,x+B\,g\,h\,x^2+\frac {B\,h^2\,x^3}{3}\right )-x\,\left (\frac {\left (3\,a\,d+3\,b\,c\right )\,\left (\frac {3\,A\,a\,d\,h^2+3\,A\,b\,c\,h^2+6\,A\,b\,d\,g\,h+B\,a\,d\,h^2\,n-B\,b\,c\,h^2\,n}{3\,b\,d}-\frac {A\,h^2\,\left (3\,a\,d+3\,b\,c\right )}{3\,b\,d}\right )}{3\,b\,d}-\frac {3\,A\,a\,c\,h^2+3\,A\,b\,d\,g^2+6\,A\,a\,d\,g\,h+6\,A\,b\,c\,g\,h+3\,B\,a\,d\,g\,h\,n-3\,B\,b\,c\,g\,h\,n}{3\,b\,d}+\frac {A\,a\,c\,h^2}{b\,d}\right )+\frac {A\,h^2\,x^3}{3}+\frac {\ln \left (a+b\,x\right )\,\left (B\,n\,a^3\,h^2-3\,B\,n\,a^2\,b\,g\,h+3\,B\,n\,a\,b^2\,g^2\right )}{3\,b^3}-\frac {\ln \left (c+d\,x\right )\,\left (B\,n\,c^3\,h^2-3\,B\,n\,c^2\,d\,g\,h+3\,B\,n\,c\,d^2\,g^2\right )}{3\,d^3} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
sympy [F(-2)] time = 0.00, size = 0, normalized size = 0.00 \[ \text {Exception raised: HeuristicGCDFailed} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________